package cn.edu.scnu.impl;

import cn.edu.scnu.entity.Member;
import cn.edu.scnu.mapper.MemberMapper;
import cn.edu.scnu.service.MemberService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * memberservice的实现类 extends ServiceImpl<MemberMapper, Member>
 */
@Service
public class MemberServiceImpl   implements MemberService {
    @Autowired
    private MemberMapper memberMapper;
    @Override
    public Member getMemberByUsername(String username) {
        QueryWrapper<Member> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("username", username);
        return memberMapper.selectOne(queryWrapper);
    }

    @Override
    public void save(Member member) {
        memberMapper.insert(member);
    }
}
